<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item> <i class="el-icon-lx-calendar"></i> 假期管理 </el-breadcrumb-item>
                <el-breadcrumb-item>假期详情</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="form-box">
                <el-form ref="form" :model="form" label-width="80px">
                    <el-divider content-position="left">假期详情</el-divider>

                    <el-form-item label="假期名称" prop="name">
                        <el-input v-model="form.name" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="假期时间">
                        <el-col :span="11">
                            <el-date-picker v-model="form.startTime" format="yyyy-MM-dd" type="date" placeholder="选择日期" disabled>
                            </el-date-picker>
                        </el-col>
                        <el-col class="line" :span="2">-</el-col>
                        <el-col :span="11">
                            <el-date-picker v-model="form.endTime" format="yyyy-MM-dd" type="date" placeholder="选择日期" disabled>
                            </el-date-picker>
                        </el-col>
                    </el-form-item>

                    <el-form-item label="状态">
                        <el-switch v-model="form.status" :active-value="'01'" :inactive-value="'00'" disabled></el-switch>
                    </el-form-item>

                    <el-form-item label="假期描述" prop="description">
                        <el-input type="textarea" rows="5" v-model="form.description" disabled></el-input>
                    </el-form-item>

                    <el-form-item>
                        <el-button @click="goback" icon="el-icon-arrow-left">返回</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'baseform',
    inject: ['reload'],
    data() {
        return {
            id: this.$route.query.id,
            positions: [],
            form: {
                name: '',
                startTime: '',
                endTime: '',
                status: '',
                position: [],
                description: ''
            }
        };
    },
    created: function () {
        this.init();
    },
    methods: {
        goback() {
            this.$router.go(-1);
        },
        async init() {
            var a = await this.$http.get('/holiday/' + this.id);

            if (a.code == 200) {
                this.form = a.data;
                this.$message.success(a.message);
            } else {
                this.$message.error(a.message);
            }
        }
    }
};
</script>